﻿namespace NTLib.Pipe.Network.Connectors
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using NTLib.Pipe.Network.Containers;
    using NTLib.Pipe.Network.Descriptors;
    using NTLib.Core.Attributes;
    using NTLib.Core.Component;
    using NTLib.Core.Threading;
    using System.Net.Http;
    using System.Diagnostics;
    using Streaming.Descriptors.Packages;
    using Streaming.Containers;

    /// <summary>
    /// 
    /// </summary>
    [GuidAttribute("db0d8991-b549-4d47-bf5d-947b9ed6b4d4")]
    public class HttpConnector : BaseConnector
    {
        #region Fields

        private readonly SemaphoreLocker _locker;
        private readonly Queue<IPackage> _packages;

        //private TaskCompletionSource<IPackage> _pkgTask;

        #endregion

        #region CTOR

        /// <summary>
        /// Initializes a new instance of the <see cref="HttpConnector"/> class.
        /// </summary>
        public HttpConnector()
        {
            this._locker = new SemaphoreLocker();
            this._packages = new Queue<IPackage>();
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets a value indicating whether this instance can pop item.
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance can pop item; otherwise, <c>false</c>.
        /// </value>
        public override bool CanPopItem
        {
            get { return false; }
        }

        /// <summary>
        /// Gets a value indicating whether this instance can push item.
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance can push item; otherwise, <c>false</c>.
        /// </value>
        public override bool CanPushItem
        {
            get { return true; }
        }

        public override Task OnSendAsync(IPackage pkg, CancellationToken token)
        {
            throw new NotImplementedException();
        }

        protected override bool checkAddress(INetworkAddress connectionAddr)
        {
            throw new NotImplementedException();
        }

        protected override Task OnCloseAsync(CancellationToken token = default(CancellationToken))
        {
            throw new NotImplementedException();
        }

        protected override Task OnConnectAsync(CancellationToken token = default(CancellationToken))
        {
            throw new NotImplementedException();
        }

        protected override Task<IPackage> OnReadAsync(IPackageDescriptor desc, CancellationToken token = default(CancellationToken))
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
